package client.controlpanel;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import source.DataSource;

/**
 * Stops data gathering, deactivates the button, activates the start button
 * @author Michal
 *
 */
public class StopGatheringButton implements ActionListener {
	JButton startButton;
	
	public StopGatheringButton(JButton startButton) {
		this.startButton = startButton;
	}
	
	@Override
	public void actionPerformed(ActionEvent buttonEvent) {
		JButton button =  (JButton) buttonEvent.getSource();
		button.setEnabled(false);
		startButton.setEnabled(true);
		
		DataSource activeDataSource = Configuration.getInstance().getActiveDataSource();
		activeDataSource.stopGatheringData(); //Just to be sure
	}

}
